package org.lagou.controller;

import org.lagou.interceptor.LoginVerify;
import org.lagou.service.ResumeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;

import java.util.Map;

@Controller
@RequestMapping("/resume")
public class ResumeController {
    @Autowired
    ResumeService resumeService;

    // 获取全部集合
    @LoginVerify
    @RequestMapping("list")
    @ResponseBody
    public Map<String, Object> list() {
        return resumeService.list();
    }

    // 跳转视图
    @LoginVerify
    @RequestMapping("resume")
    public ModelAndView resume() {
        ModelAndView modelAndView = new ModelAndView("resume");
        return modelAndView;
    }
    // 增加数据
    @LoginVerify
    @RequestMapping("add")
    @ResponseBody
    public Map<String, Object> add(String name, String address, String phone) {
        return resumeService.add(name, address, phone);
    }
    // 删除数据
    @LoginVerify
    @RequestMapping("del")
    @ResponseBody
    public Map<String, Object> del(Long id) {
        return resumeService.del(id);
    }

}
